<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>页面加载与卸载</title>
    <script type="text/javascript">
        function method01(){
            alert('页面加载方法执行！');
        }
        function  method02(){
            alert('页面卸载方法执行！');
        }
    </script>
</head>
<body onload="method01()" onunload="method02()">

</body>
</html>